package kasgroup2;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

class Speaker extends Participant {
    private ArrayList<Subject> subjectList = null;

    public ArrayList<Subject> getSubjectList() {
        return subjectList;
    }
    
    public Speaker(Participant p) {
        super(  p.getName(), 
                p.getAddress(), 
                p.getCity(),
                p.getCountry(),
                p.getFirmName(),
                p.getPhoneNumberFirm(),
                p.getPhoneNumberHome(),
                p.getArrivalDate(),
                p.getDepartureDate(),
                p.getCompanion()
                );
        subjectList = new ArrayList<Subject>();
    }
    
    public Speaker(Participant p, ArrayList<Subject> p_SubjectList) {
        this(p);
        if(p_SubjectList != null) {
            this.subjectList = p_SubjectList;
        }
    }
    
    public Speaker(String p_Name) {
        this(new Participant(p_Name, "", "", "", "", "", "", new Date(), new Date(), null));
    }
    
    public Speaker(String p_Name, ArrayList<Subject> p_SubjectList) {
        this(p_Name);
        this.subjectList = p_SubjectList;
    }
    
    public void addSubject(Subject subject) {
        this.subjectList.add(subject);
    }
    
    public void addSubject(String subjectName, String subjectDescription) {
        subjectList.add(new Subject(subjectName, subjectDescription));
    }
    
    public void removeSubject(String subjectName) {
        subjectList.remove(subjectName);
    }
    
    public Subject getSubject(Object subjectName) {
        if(subjectName != null) {
            for(Subject s : subjectList) {
                if(s.getName().equals(subjectName.toString())) {
                    return s;
                }
            }
        }
        return null;
    }
    
    public Subject getSubject(int index) {
        if(this.subjectList.size() < index) {
            return this.subjectList.get(index);
        }
        return null;
    }

    public void addSubjects(ArrayList<Subject> p_Subjects) {
        this.subjectList = p_Subjects;
    }
    
    /**
     * 
     * @param p_Name
     * @param p_Address
     * @param p_City
     * @param p_Country
     * @param p_FirmName
     * @param p_PhoneFirm
     * @param p_PhoneHome
     * @param p_Arrival
     * @param p_Departure
     * @param p_Activity
     * @param p_Hotels
     * @param p_Companion 
     *
    public Speaker(
                        String p_Name, 
                        String p_Address, 
                        String p_City, 
                        String p_Country, 
                        String p_FirmName, 
                        String p_PhoneFirm, 
                        String p_PhoneHome, 
                        Date p_Arrival, 
                        Date p_Departure, 
                        Activity p_Activity, 
                        ArrayList<Hotel> p_Hotels, 
                        Companion p_Companion) {
        super(p_Name, p_Address, p_City, p_Country, p_FirmName, p_PhoneFirm, p_PhoneHome, p_Arrival, p_Departure, p_Activity, p_Hotels, p_Companion);
    }*/
}
